﻿// Decompiled with JetBrains decompiler
// Type: System.Web.Razor.Text.TextExtensions
// Assembly: System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// MVID: 682513D6-F37E-48AC-9909-F3EE103CFF14
// Assembly location: D:\Project\Idea\无人机外网\uav\客户端工程\排查工具\bin\Release\System.Web.Razor.dll

using System.Text;

namespace System.Web.Razor.Text
{
  internal static class TextExtensions
  {
    public static void Seek(this ITextBuffer self, int characters) => self.Position += characters;

    public static ITextDocument ToDocument(this ITextBuffer self)
    {
      if (!(self is ITextDocument textDocument))
        textDocument = (ITextDocument) new SeekableTextReader(self);
      return textDocument;
    }

    public static LookaheadToken BeginLookahead(this ITextBuffer self)
    {
      int start = self.Position;
      return new LookaheadToken((Action) (() => self.Position = start));
    }

    public static string ReadToEnd(this ITextBuffer self)
    {
      StringBuilder stringBuilder = new StringBuilder();
      int num;
      while ((num = self.Read()) != -1)
        stringBuilder.Append((char) num);
      return stringBuilder.ToString();
    }
  }
}
